package com.zhengyun.service01.controller;

import com.zhengyun.service01.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private TestService testService;

    @RequestMapping("/get")
    public String get(HttpServletRequest request,String name) {
        Date d = new Date();
        System.out.println(d+"参数:"+name);
        name = name+"进入端口号："+request.getLocalPort();
        System.out.println("进入端口号："+request.getLocalPort());
        return testService.get(name);
    }
    @GetMapping("hello")
    public String hello(@RequestParam String name){
        System.out.println("进来了");
        return "hello "+name+" 我的服务端口是：1111";
    }
}
